package cc.hghl.hello.controller;

import cc.hghl.hello.dao.UserDao;
import cc.hghl.hello.bean.User;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cc.hghl.hello.serv.HelloServ;
@RestController
//@RequestMapping("/hello")
public class HelloController {
    @Autowired
    private UserDao userDao;
    @Autowired private HelloServ serv;

    //http://localhost:9000/testJSON
    @GetMapping("/testJSON")
    public Object testJSON(String email, String message){
        System.out.println(new Throwable().getStackTrace()[0] + "正在执行");
        return serv.testJSON(email, message);
    }

    //http://localhost:9000/hello
    @RequestMapping("/hello")
    public String hello(){
        System.out.println(new Throwable().getStackTrace()[0] + "正在执行");
        return "hello";
    }
    //http://localhost:9000/helloJSON
    @GetMapping("/helloJSON")
    public Object helloJSON(){
        System.out.println(new Throwable().getStackTrace()[0]);
        User vo = new User();
        vo.setId(100);
        vo.setUsername("admin");
        vo.setPassword("123456");
        System.out.println(vo);
        return vo;
    }
}
